<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class CreateCurriculumTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('curriculum', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('mechanism_id')->default(0)->comment('机构 id');
            $table->unsignedInteger('class_id')->default(0)->comment('班级id');
            $table->unsignedInteger('book_id')->default(0)->comment('教材 id');
            $table->unsignedInteger('unit_id')->default(0)->comment('单元 id');
            $table->unsignedTinyInteger('link')->default(0)
                ->comment('环节：1.单词一 2.单词二 3.视频 4.音乐 5.自然拼读 6.测试');
            $table->date('dated')->nullable()->comment('时间');
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `curriculum` comment '课程表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('curriculum');
    }
}
